<?php

/**
 * evenement form base class.
 *
 * @method evenement getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseevenementForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'evt_id'        => new sfWidgetFormInputHidden(),
      'evt_prj_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => false)),
      'evt_cat_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => true)),
      'evt_evenement' => new sfWidgetFormTextarea(),
      'evt_date'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'evt_id'        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('evt_id')), 'empty_value' => $this->getObject()->get('evt_id'), 'required' => false)),
      'evt_prj_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'))),
      'evt_cat_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'required' => false)),
      'evt_evenement' => new sfValidatorString(array('max_length' => 2048, 'required' => false)),
      'evt_date'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('evenement[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'evenement';
  }

}
